/**
 * 
 */
package uit.comstore.model.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * @author XIII
 *
 */
@Entity
@Table(name="Bills")
@SuppressWarnings("serial")
public class Bill implements Serializable {

	private Long id;
	private String customerName;
	private String customerEmail;
	private String customerAddress;
	private String customerPhone;
	private Date datePurchased;
	private BigDecimal total;
	
	private Set<BillDetail> billDetail = new HashSet<BillDetail>();
	
	@Id
	@GeneratedValue
	@Column(name="BillsId")
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	
	@Column(name="CustomersName")
	public String getCustomerName() {
		return customerName;
	}
	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}
	
	@Column(name="CustomersEmailAddress")
	public String getCustomerEmail() {
		return customerEmail;
	}
	public void setCustomerEmail(String customerEmail) {
		this.customerEmail = customerEmail;
	}
	
	@Column(name="CustomersAddress")
	public String getCustomerAddress() {
		return customerAddress;
	}
	public void setCustomerAddress(String customerAddress) {
		this.customerAddress = customerAddress;
	}
	
	@Column(name="CustomersPhone")
	public String getCustomerPhone() {
		return customerPhone;
	}
	public void setCustomerPhone(String customerPhone) {
		this.customerPhone = customerPhone;
	}
	
	@Column(name="DatePurchased")
	public Date getDatePurchased() {
		return datePurchased;
	}
	public void setDatePurchased(Date datePurchased) {
		this.datePurchased = datePurchased;
	}
	
	@Column(name="BillsTotal")
	public BigDecimal getTotal() {
		return total;
	}
	public void setTotal(BigDecimal total) {
		this.total = total;
	}
	
	@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
	@JoinColumn(name="BillsId", referencedColumnName="BillsId")
	public Set<BillDetail> getBillDetail() {
		return billDetail;
	}
	public void setBillDetail(Set<BillDetail> billDetail) {
		this.billDetail = billDetail;
	}
}
